package xman.core.component;

import javax.servlet.ServletContextEvent;

import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;

public class WebContextLoaderListener extends ContextLoaderListener {
    private static final Logger logger = Logger.getLogger(WebContextLoaderListener.class);
    
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        SpringUtil.setApplicationContext((WebApplicationContext) event.getServletContext().getAttribute(
                WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE));
        logger.info("------WebContextListener Initialization-------");
    }
    
    public void contextDestroyed(ServletContextEvent event) {
    }
}
